//
//  Swift+LL.swift
//  NCFinance
//
//  Created by 田玉城 on 2020/4/26.
//  Copyright © 2020 cn.com.cnfic.www. All rights reserved.
//

import Foundation
import UIKit

/// 类型协议
public protocol LLSwiftWrapperProtocol {
    associatedtype LLSwiftWrapperType ///泛型
    var llWrappedValue: LLSwiftWrapperType { get }
    init(value: LLSwiftWrapperType)
}
/// 泛型实现协议
public struct LLSwiftNamespaceWrapper<Base>: LLSwiftWrapperProtocol {
    public let llWrappedValue: Base
    public init(value: Base) {
        self.llWrappedValue = value
    }
}




/// 命名空间协议
public protocol LLSwiftNamespaceWrappable {
    associatedtype LLSwiftWrapperType
    var ll: LLSwiftWrapperType { get }
    static var ll: LLSwiftWrapperType.Type { get }
}

public extension LLSwiftNamespaceWrappable {
    /// 实体类调用
    var ll: LLSwiftNamespaceWrapper<Self> {
        return LLSwiftNamespaceWrapper(value: self)
    }
    ///静态调用
    static var ll: LLSwiftNamespaceWrapper<Self>.Type {
        return LLSwiftNamespaceWrapper.self
    }
}




/// 定义
extension UIApplication : LLSwiftNamespaceWrappable {}
extension UIViewController : LLSwiftNamespaceWrappable {}
extension String : LLSwiftNamespaceWrappable {}
extension Date : LLSwiftNamespaceWrappable {}
extension UIView: LLSwiftNamespaceWrappable {}
extension UIImage: LLSwiftNamespaceWrappable {}
extension CGFloat: LLSwiftNamespaceWrappable {}
extension Double: LLSwiftNamespaceWrappable {}
extension UIScreen: LLSwiftNamespaceWrappable {}
